package com.example.portlocalforward.config;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.example.portlocalforward.controller.model.ApiResponse;

@RestControllerAdvice
public class GlobalRequestExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    public ResponseEntity<ApiResponse<?>> handleRuntimeException(RuntimeException e) {
        return ResponseEntity.ok(ApiResponse.error(500, e.getMessage()));
    }
}
